﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using QLTV_Public;

namespace QLTV_Data
{
  public  class QuyenHan_Data
    {
      KetNoiCSDL_Data kn = new KetNoiCSDL_Data();
      public DataTable LayDuLieu()
      {
          return kn.LayDuLieu("Load_tbl_QuyenHan");
      }
      public int Insert_QuyenHan(QuyenHan_Public tenQuyen,QuyenHan_Public ghiChu)
      {
          int Nparameter = 2;
          string[]name=new string[Nparameter];
          object[] value = new object[Nparameter];
          name[0] = "@TenQuyen";
          value[0] = tenQuyen.TenQuyen;
          name[1] = "@GhiChu";
          value[1] = ghiChu.GhiChu;
          return kn.update("Insert_QuyenHan",name,value,Nparameter);
      }
      public int Update_QuyenHan(QuyenHan_Public maQuyen, QuyenHan_Public tenQuyen, QuyenHan_Public ghiChu)
      {
          int Nparameter = 3;
          string[] name = new string[Nparameter];
          object[] value = new object[Nparameter];
          name[0] = "@MaQuyen";
          value[0] = maQuyen.MaQuyen;
          name[1] = "@TenQuyen";
          value[1] = tenQuyen.TenQuyen;
          name[2] = "@GhiChu";
          value[2] = ghiChu.GhiChu;
          return kn.update("Update_QuyenHan", name, value, Nparameter);
      }
      public int Delete_QuyenHan(QuyenHan_Public maQuyen)
      {
          int Nparameter = 1;
          string[] name = new string[Nparameter];
          object[] value = new object[Nparameter];
          name[0] = "@MaQuyen";
          value[0] = maQuyen.MaQuyen;
          return kn.update("Delete_QuyenHan", name, value, Nparameter);
      }
    }
}
